using System;
using System.Management;
using System.Runtime.InteropServices;

public class WMICardGrab
{
    public static string GetClientsysInfo()
    {
        try
        {
            string str = "";
            ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'TRUE'");
            foreach (ManagementObject obj2 in searcher.Get())
            {
                string[] strArray = (string[]) obj2["IPAddress"];
                string[] strArray2 = (string[]) obj2["IPSubnet"];
                string[] strArray3 = (string[]) obj2["DefaultIPGateway"];
                string[] strArray4 = (string[]) obj2["DNSServerSearchOrder"];
                str = string.Format("Network Card: {0}<br>", obj2["Description"]);
                str = str + string.Format(" MAC Address: {0}<br>", obj2["MACAddress"]);
                foreach (string str2 in strArray)
                {
                    str = str + string.Format(" IP Address: {0}<br>", str2);
                }
                foreach (string str3 in strArray2)
                {
                    str = str + string.Format(" Subnet Mask: {0}<br>", str3);
                }
                foreach (string str4 in strArray3)
                {
                    str = str + string.Format("defaultgateways: {0}<br>", str4);
                }
                foreach (string str5 in strArray4)
                {
                    str = str + string.Format(" dns: {0}<br>", str5);
                }
            }
            return str;
        }
        catch
        {
            return "error!";
        }
    }

    public static string GetCPUId()
    {
        ManagementObjectCollection instances = new ManagementClass("Win32_Processor").GetInstances();
        foreach (ManagementObject obj2 in instances)
        {
            return obj2.Properties["ProcessorId"].Value.ToString();
        }
        return null;
    }

    [DllImport("kernel32")]
    private static extern void GetSystemInfo(ref CPUInfo cpuInfo);
}

